Skip to content

queries/jjdescription: highlight the body as text, not as a string - #16172

Open
lukehsiao wants to merge 1 commit into
helix-editor:masterfrom
lukehsiao-forks:master
Open

queries/jjdescription: highlight the body as text, not as a string#16172
lukehsiao wants to merge 1 commit into
helix-editor:masterfrom
lukehsiao-forks:master

Conversation

@lukehsiao

@lukehsiao lukehsiao commented Aug 11, 2026

Copy link
Copy Markdown

The query captures the entire message body as @string. jjdescription was added by copying git-commit's language rules, but the two queries disagree about the part you actually type: git-commit leaves the body uncaptured so it renders as ui.text, and marks only the subject line as a heading.

Scoping prose as a string gives it a color chosen for string literals, which many themes deliberately keep close to comment, so the description is hard to separate from the JJ: boilerplate. String colors are also tuned to sit against code rather than to carry a paragraph, so the body can land below a readable contrast against the background.

One real-world example are the 22 stock Omarchy themes, which generate their Helix theme from one shared template, the body as @string fails WCAG AA against the background in four of them (catppuccin-latte, flexoki-light, miasma, retro-82), and on retro-82 it sits at 1.34:1 against the JJ: comments. Left to ui.text it passes in all 22, and retro-82 becomes 4.54:1 against the comments and 13.39:1 against the background. Of the 279 languages with highlight queries, jjdescription is the only one that captures a bare prose node as @string.

The grammar has no subject node, so the subject line is matched as the first named child of the document.

Example before/after

Default theme

helix-jjdescription-default-before helix-jjdescription-default-after

Retro 82 in Omarchy

helix-jjdescription-retro82-before helix-jjdescription-retro82-after

The query captures the entire message body as `@string`. `jjdescription`
was added by copying git-commit's language rules, but the two queries
disagree about the part you actually type: git-commit leaves the body
uncaptured so it renders as `ui.text`, and marks only the subject line
as a heading.

Scoping prose as a string gives it a color chosen for string literals,
which many themes deliberately keep close to comment, so the description
is hard to separate from the `JJ:` boilerplate. String colors are also
tuned to sit against code rather than to carry a paragraph, so the body
can land below a readable contrast against the background.

One real-world example are the 22 stock Omarchy themes, which generate
their Helix theme from one shared template, the body as `@string` fails
WCAG AA against the background in four of them (catppuccin-latte,
flexoki-light, miasma, retro-82), and on retro-82 it sits at 1.34:1
against the JJ: comments. Left to `ui.text` it passes in all 22, and
retro-82 becomes 4.54:1 against the comments and 13.39:1 against the
background. Of the 279 languages with highlight queries, `jjdescription`
is the only one that captures a bare prose node as @string.

The grammar has no subject node, so the subject line is matched as the
first named child of the document.

Signed-off-by: Luke Hsiao <luke@hsiao.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant